<template>
	<view class="box">
		<view class="top">
			<view class="img">
				<image :src="obj.url == ''?'../../static/images/cs.png':obj.url" mode=""></image>
			</view>
			<view class="button">
				<button @click="register" >{{obj.name == ''?'点击登录':obj.name}}</button>
			</view>
		</view>
		<view class="down">
			<button open-type="share">推荐给好友</button>
			<button open-type="contact">联系客服</button>
			<button open-type="feedback">意见反馈</button>
			<button>极限选号</button>
			<button>极限赛事</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				obj:{
					url:'',
					name:''
				}
			};
		},
		mounted() {
			this.obj = uni.getStorageSync('userinfo')||''
		},
		methods:{
			register(){
				uni.getUserInfo({  // 获取用户姓名头像储存到本地
						success:(res)=>{
							this.obj = {
								url:res.userInfo.avatarUrl,
								name:res.userInfo.nickName
							}
							uni.setStorageSync('userinfo',this.obj)
						}
				})
				
			}
		},

		
	}
</script>

<style lang="scss">
	.box{
		width: 100%;
		height: 100vh;
		background-color: #ff707d;
	}
.top{
	.img{
		width: 200rpx;
		height: 200rpx;
		border-radius: 50%;
		background-color: yellow;
		width: 1;
		margin: 0 auto;
		image{
			width: 200rpx;
			height: 200rpx;
			border-radius: 50%;
		}
	}
	.button{
		width: 300rpx;
		margin: 10px auto;
		
	}
}
</style>
